package com.base.cn.platform.os.controller.web.qa.thumb;

import com.base.cn.platform.os.common.WebBaseController;
import com.base.cn.platform.os.service.course.qa.thumb.QaThumbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Map;

/**
 * PC端问题点赞Controller
 *
 * @author LIZHIPENG
 * @create 2018-05-17 下午 7:44
 */
@Controller
@RequestMapping("/web/uc/qa/thumb")
public class WebQaThumbController extends WebBaseController {

    @Autowired
    private QaThumbService qaThumbService;

    /**
     * 问题点赞、取消点赞方法
     * @param request
     * @param questionId 问题ID
     * @return
     */
    @RequestMapping("/thumbQuestion")
    @ResponseBody
    public Map<String, Object> thumbQuestion(HttpServletRequest request,
                                             @RequestParam("questionId") BigDecimal questionId){
        BigDecimal userId = webMobileLoginUtil.getLoginUserId(request);
        return qaThumbService.thumbQuestion(questionId, userId);
    }
}
